﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
                
>
  <xsl:output method="html" indent="yes" encoding="utf-8" media-type="text/xml" />
  <xsl:param name="relrootpath"/>
  <xsl:param name="eventname" />
  <xsl:include href="../Utility.xslt" />
  <xsl:template match="/Context">

    <Transform>
      <Content>
        <xsl:apply-templates select="Event[@Name=$eventname]">
        </xsl:apply-templates>
      </Content>
    </Transform>

  </xsl:template>

  <xsl:template match="Event[@Name='LearningSignOff']">
    <div>
      <div class="fc">
        <div class="left">
          <control kind="useravatar" ShowNickName="false">
            <xsl:attribute name="UserId">
              <xsl:value-of select="SignOffUserId"/>
            </xsl:attribute>
          </control>
        </div>
        <div>
          <strong>结束互助</strong>
          <br />
          <control kind="userlink">
            <xsl:attribute name="UserId">
              <xsl:value-of select="SignOffUserId"/>
            </xsl:attribute>
          </control>
          <xsl:text>已经确认结束</xsl:text>
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="$relrootpath"/>
              <xsl:text>/Mod/Learning/MyLearning.aspx?id=</xsl:text>
              <xsl:value-of select="LearningHistoryId"/>
            </xsl:attribute>
            <span>本次</span>
          </a>
          <xsl:text>互助活动。</xsl:text>
          <div>
            并且给你作出了评价：
            <xsl:call-template name="scoreconverters">
              <xsl:with-param name="score" select="Score" />
            </xsl:call-template>
          </div>
          <div class="litetext mcmt">
            "<xsl:value-of select="Comment" disable-output-escaping="yes"/>"
          </div>
        </div>
      </div>
      <div class="msgact">
        <span class="nss ns-doc">
          <xsl:text> </xsl:text>
        </span>
        <span class="iconlabel">
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="$relrootpath"/>
              <xsl:text>/Mod/Learning/MyLearning.aspx?id=</xsl:text>
              <xsl:value-of select="LearningHistoryId"/>
            </xsl:attribute>
            查看详细
          </a>
        </span>
      </div>
    </div>
  </xsl:template>

  <xsl:template match="Event[@Name='GroupApproved']">

  </xsl:template>
 
  <xsl:template name="scoreconverters">
    <xsl:param name="score" />
    <xsl:variable name="src">
      <xsl:choose>
        <xsl:when test="$score=3">
          <xsl:text>flower</xsl:text>
        </xsl:when>
        <xsl:when test="$score=2">
          <xsl:text>smile</xsl:text>
        </xsl:when>
        <xsl:when test="$score=1">
          <xsl:text>shakehand</xsl:text>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    
    <span class="nss ns-{$src}">
      <xsl:text> </xsl:text>
    </span>
    <!--
    <span class="iconlabel">
      (
      <xsl:value-of select="$score"/>
      <xsl:text>分</xsl:text>
      )
    </span>-->
    </xsl:template>

  </xsl:stylesheet>
